import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import AutoImport from 'unplugin-auto-import/vite'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      imports: [
        'vue',
        'vue-router', // 如果需要 vue-router 的自动导入
        // 其他自动导入的库...
      ],
      dts: true, // 生成自动导入的 TypeScript 声明文件
    }),
  ],
  css: {
    preprocessorOptions: {
      scss: {
        api: 'modern-compiler', // or 'modern' 
        javascriptEnabled: true,
        additionalData: `@use "@/assets/style/mixin.scss" as *;` // 添加全局样式文件路径
      }
    }
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
      '@img': path.resolve(__dirname, './src/assets/img'),
    },
  },
})
